<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%
	String path = request.getContextPath();
%>
<html>
	<head>
		<title>index.jsp</title>
		<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/btn_class.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/extjs/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/extjs/style.css" />
<script type="text/javascript"
	src="<%=path%>/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=path%>/extjs/ext-all.js"></script>
 <script type="text/javascript" src="<%=path%>/ext-2.2/build/locale/ext-lang-zh_CN.js"></script>

<script type="text/javascript" src = "<%=path%>/FusionCharts/FusionCharts.js"></script>
	<script type="text/javascript" src = "<%=path%>/FusionCharts/FusionChartsExportComponent.js"></script>
	<script type="text/javascript" src="<%=path%>/js/datepicker/WdatePicker.js" defer="defer"></script>
	<script type="text/javascript" src="<%=path%>/mould_published/public.js" defer="defer"></script>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<style type="text/css">
	
	.app_mzyy {
        background-image:url(<%=path%>/extjs/icons/pill.png);
    }
    .app_txgz {
        background-image:url(<%=path%>/extjs/icons/phone_sound.png);
    }
    .app_jtzx {
        background-image:url(<%=path%>/extjs/icons/group.png);
    }
    .app_xyjc {
        background-image:url(<%=path%>/extjs/icons/chart_curve.png);
    }
    .app_xtjc {
        background-image:url(<%=path%>/extjs/icons/chart_line.png);
    }
    .app_hyjc {
        background-image:url(<%=path%>/extjs/icons/report.png);
    }
    
    </style>
</head>

<body >
<script type="text/javascript">
Ext.onReady(function(){

	var Jthtwb = Ext.data.Record.create([ {
					name : 'fpid',
					mapping : 'fpid',
					type : 'string'
				}, {
					name : 'fname',
					mapping : 'fname',
					type : 'string'
				}, {
					name : 'fstate',
					mapping : 'fstate',
					type : 'string'
				}, {
					name : 'fsex',
					mapping : 'fsex',
					type : 'string'
				}, {
					name : 'fphone1',
					mapping : 'fphone1',
					type : 'string'
				}, {
					name : 'fphone2',
					mapping : 'fphone3',
					type : 'string'
				}, {
					name : 'flis',
					mapping : 'flis',
					type : 'string'
				}, {
					name : 'fxyj',
					mapping : 'fxyj',
					type : 'string'
				}, {
					name : 'fyytx',
					mapping : 'fyytx',
					type : 'string'
				}, {
					name : 'fdate',
					mapping : 'fdate',
					type : 'string'
				}, {
					name : 'fsign_date',
					mapping : 'fsign_date',
					type : 'string'
				}, {
					name : 'fexception_low',
					mapping : 'fexception_low',
					type : 'string'
				}, {
					name : 'fexception_high',
					mapping : 'fexception_high',
					type : 'string'
				}, {
					name : 'fgz_exception',
					mapping : 'fgz_exception',
					type : 'string'
				}, {
					name : 'fphone3',
					mapping : 'fphone3',
					type : 'string'
				}, {
					name : 'fssy_high',
					mapping : 'fssy_high',
					type : 'string'
				}, {
					name : 'fssy_low',
					mapping : 'fssy_low',
					type : 'string'
				}, {
					name : 'fszy_high',
					mapping : 'fszy_high',
					type : 'string'
				}, {
					name : 'fszy_low',
					mapping : 'fszy_low',
					type : 'string'
				}, {
					name : 'fxl_high',
					mapping : 'fxl_high',
					type : 'string'
				}, {
					name : 'fxl_low',
					mapping : 'fxl_low',
					type : 'string'
				}, {
					name : 'fxt_high',
					mapping : 'fxt_high',
					type : 'string'
				}, {
					name : 'fxt_low',
					mapping : 'fxt_low',
					type : 'string'
				} ]);

				var ds = new Ext.data.Store({
					reader : new Ext.data.JsonReader({
						totalProperty : 'totalProperty',
						root : 'root'
					}, Jthtwb),
					idProperty : 'threadid',
					remoteSort : true,
					url : 'patient!queryPatientSigned.do'
				});

				ds.load( {
					params : {
						start : 0,
						limit : 50,
						fstate : '1',
						fkeywords : '',
					//	fbtime : '',
						fetime : ''
					}
				});


				//定义勾选框，不需要可不必定义
				var sm = new Ext.grid.CheckboxSelectionModel({
					singleSelect : true //单选
				});
				
				

				//定义列
				var colM = new Ext.grid.ColumnModel([ sm, // new Ext.grid.RowNumberer(),//增加自动编号，不需要可不必定义
				    {
						header : '姓名',
						dataIndex : 'fname',
						width : 80,
						sortable : false
					}, {
						header : '性别',
						dataIndex : 'fsex',
						width : 60,
						renderer : function(value) {
								if (value == "1" || value == "男") {
									return "男";
								} else if (value == "2" || value == "女") {
									return "女";
								} else {
									return "";
								}
							}
					},{
						header : '手机号码',
						dataIndex : 'fphone1',
						width : 100,
						renderer : function(value) {
								if (value == null || value == "null") {
									return "";
								} else {
									return value;
								}
							}
					},{
						header : '身份证号',
						dataIndex : 'fsfzh',
						width : 100,
						renderer : function(value) {
								if (value == null || value == "null") {
									return "";
								} else {
									return value;
								}
							}
					},{
						header : '医保卡号',
						dataIndex : 'fybkh',
						width : 100,
						renderer : function(value) {
								if (value == null || value == "null") {
									return "";
								} else {
									return value;
								}
							}
					}, {
						header : '血压监测',
						dataIndex : 'fxyjc',
						width : 80,
						renderer : function(value) {
								if (value == "1" || value == "on") {
									return "<img src='<%=path%>/ext-2.2/icons/tick.png' border=0>";
								} else {
									return "<img src='<%=path%>/ext-2.2/icons/cross.png' border=0>";
								}
							}
					}, {
						header : '血糖监测',
						dataIndex : 'fxtjc',
						width : 80,
						renderer : function(value) {
								if (value == "1" || value == "on") {
									return "<img src='<%=path%>/ext-2.2/icons/tick.png' border=0>";
								} else {
									return "<img src='<%=path%>/ext-2.2/icons/cross.png' border=0>";
								}
							}
					}, {
						header : '血脂',
						dataIndex : 'fxzjc',
						width : 80,
						renderer : function(value) {
								if (value == "1" || value == "on") {
									return "<img src='<%=path%>/ext-2.2/icons/tick.png' border=0>";
								} else {
									return "<img src='<%=path%>/ext-2.2/icons/cross.png' border=0>";
								}
							}
					}, {
						header : '血尿酸',
						dataIndex : 'fxnsjc',
						width : 80,
						renderer : function(value) {
								if (value == "1" || value == "on") {
									return "<img src='<%=path%>/ext-2.2/icons/tick.png' border=0>";
								} else {
									return "<img src='<%=path%>/ext-2.2/icons/cross.png' border=0>";
								}
							}
					}, {
						header : '血肌酐',
						dataIndex : 'fxjgjc',
						width : 80,
						renderer : function(value) {
								if (value == "1" || value == "on") {
									return "<img src='<%=path%>/ext-2.2/icons/tick.png' border=0>";
								} else {
									return "<img src='<%=path%>/ext-2.2/icons/cross.png' border=0>";
								}
							}
					}, {
						header : '血氧饱和度',
						dataIndex : 'fxybhdjc',
						width : 100,
						renderer : function(value) {
								if (value == "1" || value == "on") {
									return "<img src='<%=path%>/ext-2.2/icons/tick.png' border=0>";
								} else {
									return "<img src='<%=path%>/ext-2.2/icons/cross.png' border=0>";
								}
							}
					}, {
						header : '心电',
						dataIndex : 'fxdjc',
						width : 80,
						renderer : function(value) {
								if (value == "1" || value == "on") {
									return "<img src='<%=path%>/ext-2.2/icons/tick.png' border=0>";
								} else {
									return "<img src='<%=path%>/ext-2.2/icons/cross.png' border=0>";
								}
							}
					}, {
						header : '位置服务',
						dataIndex : 'fwzfw',
						width : 80,
						renderer : function(value) {
								if (value == "1" || value == "on") {
									return "<img src='<%=path%>/ext-2.2/icons/tick.png' border=0>";
								} else {
									return "<img src='<%=path%>/ext-2.2/icons/cross.png' border=0>";
								}
							}
					} ]);

				//生成表格
				var grid = new Ext.grid.GridPanel({
					closable : false,
					region : 'center',
					layout:'fit',
					height : 350,
					autoWidth : true,
					stripeRows : true,
					//title : '角色列表',
					cm : colM,
					ds : ds,
					sm : sm,
					listeners : {
						'rowclick' : function(grid, row) { //双击打开
							var record = grid.getSelectionModel().getSelected();
							if (record) {
							    window.frames["ifr_xyjc"].location.href = "app_xyjc.jsp?fphone=" + record.data.fphone1;   
								window.frames["ifr_xtjc"].location.href = "app_xtjc.jsp?fphone=" + record.data.fphone1;
								window.frames["ifr_xyjc"].location.href = "app_xyjc.jsp?fphone=" + record.data.fphone1;
								window.frames["ifr_xyjc"].location.href = "app_xyjc.jsp?fphone=" + record.data.fphone1;
								window.frames["ifr_xyjc"].location.href = "app_xyjc.jsp?fphone=" + record.data.fphone1;
								window.frames["ifr_jtzx"].location.href = "app_jtzx.jsp?fphone=" + record.data.fphone1;
								
								
							    // Ext.getCmp('xyjc_id').load({url:"app_xyjc.jsp?fphone='15105210211'",scripts:true});
								// sign_mod_fun(record.data.fpid, record.data.fname, record.data.fsex, record.data.fadd_detail, record.data.fphone1, record.data.fphone2);
							}
						}
					},
					bbar : new Ext.PagingToolbar({
				        pageSize: 50,
				        store: ds,
				        displayInfo: true,
				        displayMsg: '共 {2} 条记录',
				        emptyMsg: "没有记录"
				    })
				});
				
				var e_date = new Ext.form.DateField({
	   				fieldLabel : '合约终止日期',
	   				format: 'Y-m-d',
	   				id:'fetime_id',
					name:'fedate',
					width : 110,
	   				style:"cursor:pointer;color:blue"
	   			});
	   			
	   			var btn_search_patient = new Ext.Button({
					text : '查询',
					iconCls : 'sy-search',
					handler : function(btn) {
						ds.removeAll();
						ds.load( {
							params : {
								start : 0,
								limit : 50,
								fstate : '1',
								fkeywords : Ext.get('fkeywords_id').dom.value,
							//	fbtime : Ext.get('fbtime_id').dom.value,
								fetime : Ext.get('fetime_id').dom.value
								
							}
						});
					}
				});
				
			    var btn_send_mess = new Ext.Button({
					text : '发送短信',
					iconCls : 'sy-send-info',
					handler : function() {
					var record = grid.getSelectionModel().getSelected();
						if (record) {
							Ext.Ajax.request( {
								url : 'mess!sendMess.do',
								params:{
				    	        	fphone : record.data.fphone,
				    	        	fcontent : Ext.get('fcontent_q_id').dom.value
					    	    },
								success : function() {
									Ext.MessageBox.alert(
													'提示',
													'发送成功！');
								},
								failure : function() {
									Ext.Msg.show( {
										title : '错误提示',
										msg : '发送失败！！',
										buttons : Ext.Msg.OK,
										icon : Ext.Msg.ERROR
									});
								}
							});
						} else {
							Ext.MessageBox.alert('提示', '请选择一行纪录进行操作！');
						}
					}
				});
				
				var btn_mess_clean = new Ext.Button({
					text : '清空内容',
					iconCls : 'sy-email-error',
					handler : function() {
						Ext.get("fcontent_q_id").dom.value  = "";
					}
				});
				
				var btn_mess_temp = new Ext.Button({
					text : '短信模板',
					iconCls : 'sy-email_link',
					handler : function() {
					
					
					}
				});
			    
				 var twoTbar = new Ext.Toolbar({
					items:[ '关键字：', {
						xtype : 'textfield',
						fieldLabel : '关键字',
						id : 'fkeywords_id',
						name : 'fkeywords',
						style:"cursor:pointer;color:blue",
						width : 120
					}, '-', btn_search_patient  
				    ]
			    });
				
			    
			    var panel = new Ext.Panel({
			    	region: "west",
			    	layout : 'fit',
					border : true,
					margins:'0 5 0 0',
					tbar : ['合约终止日期 <b> < <b/>', e_date ],
					listeners : {
						'render' : function(){
							// oneTbar.render(this.tbar); 
							twoTbar.render(this.tbar); 
						}
				 	},
					split:true,
		            minSize: 175,
		            maxSize: 600,
		            collapsible: true,
		            collapsed: false,
		            margins:'0 0 0 0',
		            layoutConfig:{
		                animate:true
		            },
				 	width:280,
					items : [ grid]
				});
				
	
	
	
	var center_panels = new Ext.TabPanel({
					region : 'center',
					resizeTabs : false,
					id : 'center-panel',
					cls : 'empty',
					activeTab : 0,
					// bodyStyle : 'background:#FFFFFF',
					autoScroll : true,
				    items :[{
							title : '血压监测',
							iconCls : 'app_xyjc',
							id : 'xyjc_id',
							html : '<html><head></head><body><iframe name="ifr_xyjc" id="ifr_xyjc" scrolling="auto" frameborder="0" width="100%" height="100%" '
								+ 'src="app_xyjc.jsp?fphone=1"></iframe></body></html>',
							closable : false
						},{
							title : '血糖监测',
							iconCls : 'app_xtjc',
							html : '<html><head></head><body><iframe name="ifr_xtjc" id="ifr_xtjc" scrolling="auto" frameborder="0" width="100%" height="100%" '
								+ 'src="app_xtjc.jsp?fphone=1"></iframe></body></html>',
							closable : false
						}, {
							title : '化验检查',
							iconCls : 'app_hyjc',
							html : '<html><head></head><body><iframe name="ifr_hyjc" id="ifr_hyjc" scrolling="auto" frameborder="0" width="100%" height="100%" '
								+ 'src="app_hyjc.jsp"></iframe></body></html>',
							closable : false
						}, {
							title : '门诊用药',
							iconCls : 'app_mzyy',
							html : '<html><head></head><body><iframe name="ifr_mzyy" id="ifr_mzyy" scrolling="auto" frameborder="0" width="100%" height="100%" '
								+ 'src="app_mzyy.jsp"></iframe></body></html>',
							closable : false
						}, {
							title : '提醒告知',
							iconCls : 'app_txgz',
							html : '<html><head></head><body><iframe name="ifr_txgz" id="ifr_txgz" scrolling="auto" frameborder="0" width="100%" height="100%" '
								+ 'src="buginfo.jsp"></iframe></body></html>',
							closable : false
						}, {
							title : '家庭中心',
							iconCls : 'app_jtzx',
							html : '<html><head></head><body><iframe name="ifr_jtzx" id="ifr_jtzx" scrolling="auto" frameborder="0" width="100%" height="100%" '
								+ 'src="buginfo.jsp"></iframe></body></html>',
							closable : false
						}]
				});
	
	
    var panelmenu = new Ext.Panel({
			region: "center",
			layout:'fit',
            margins:'0 0 0 0',
            layoutConfig:{
                animate:true
            },
            title: '',
            tbar : ['快发信息：',
						    {
						xtype : 'textarea',
						id : 'fcontent_q_id',
						name : 'fcontent',
						style:"cursor:pointer;color:blue;",
						height : 60,
						width : 500
					}, '-', btn_send_mess , '-', btn_mess_clean ],
		    items :[center_panels]
			
	   });	

    
 	new Ext.Viewport( {
		layout : "border",
		items : [panelmenu,panel]
	});
	
	Ext.getCmp('fkeywords_id').focus(false, 300); //解决焦点无法获取问题 ， 使光标可以定位到选框
});
</script>

</body>
</html>
